import turtle
import math

def draw_cat():
    # 设置画布和初始状态
    screen = turtle.Screen()
    screen.title("可爱的小猫")
    screen.bgcolor("#f0f0f0")
    
    # 创建绘图对象
    cat = turtle.Turtle()
    cat.speed(3)  # 控制绘图速度
    cat.pensize(2)
    cat.color("#333333")
    
    # 绘制头部
    cat.penup()
    cat.goto(0, -100)
    cat.pendown()
    cat.begin_fill()
    cat.circle(100)  # 头部是一个圆形
    cat.fillcolor("#f8d8b2")  # 浅棕色
    cat.end_fill()
    
    # 绘制左耳
    cat.penup()
    cat.goto(-60, 50)
    cat.pendown()
    cat.begin_fill()
    cat.goto(-100, 120)
    cat.goto(-40, 80)
    cat.goto(-60, 50)
    cat.fillcolor("#f8d8b2")
    cat.end_fill()
    
    # 绘制右耳
    cat.penup()
    cat.goto(60, 50)
    cat.pendown()
    cat.begin_fill()
    cat.goto(100, 120)
    cat.goto(40, 80)
    cat.goto(60, 50)
    cat.fillcolor("#f8d8b2")
    cat.end_fill()
    
    # 耳朵内部（粉红色）
    cat.penup()
    cat.goto(-80, 100)
    cat.pendown()
    cat.begin_fill()
    cat.goto(-65, 85)
    cat.goto(-50, 95)
    cat.goto(-80, 100)
    cat.fillcolor("#ffb6c1")
    cat.end_fill()
    
    cat.penup()
    cat.goto(80, 100)
    cat.pendown()
    cat.begin_fill()
    cat.goto(65, 85)
    cat.goto(50, 95)
    cat.goto(80, 100)
    cat.fillcolor("#ffb6c1")
    cat.end_fill()
    
    # 绘制左眼
    cat.penup()
    cat.goto(-30, 30)
    cat.pendown()
    cat.begin_fill()
    cat.circle(10)
    cat.fillcolor("white")
    cat.end_fill()
    
    # 左眼瞳孔
    cat.penup()
    cat.goto(-35, 30)
    cat.pendown()
    cat.begin_fill()
    cat.circle(5)
    cat.fillcolor("black")
    cat.end_fill()
    
    # 绘制右眼
    cat.penup()
    cat.goto(30, 30)
    cat.pendown()
    cat.begin_fill()
    cat.circle(10)
    cat.fillcolor("white")
    cat.end_fill()
    
    # 右眼瞳孔
    cat.penup()
    cat.goto(25, 30)
    cat.pendown()
    cat.begin_fill()
    cat.circle(5)
    cat.fillcolor("black")
    cat.end_fill()
    
    # 绘制鼻子
    cat.penup()
    cat.goto(0, 10)
    cat.pendown()
    cat.begin_fill()
    cat.circle(5)
    cat.fillcolor("#ffb6c1")
    cat.end_fill()
    
    # 绘制嘴巴
    cat.penup()
    cat.goto(0, 10)
    cat.pendown()
    cat.goto(0, -10)
    cat.penup()
    cat.goto(-15, -20)
    cat.pendown()
    cat.goto(0, -10)
    cat.goto(15, -20)
    
    # 绘制胡须
    # 左胡须
    cat.penup()
    cat.goto(-10, 0)
    cat.pendown()
    cat.goto(-50, 5)
    cat.penup()
    cat.goto(-10, -5)
    cat.pendown()
    cat.goto(-50, -5)
    # 右胡须
    cat.penup()
    cat.goto(10, 0)
    cat.pendown()
    cat.goto(50, 5)
    cat.penup()
    cat.goto(10, -5)
    cat.pendown()
    cat.goto(50, -5)
    
    # 隐藏画笔
    cat.hideturtle()
    
    # 保持窗口打开
    screen.mainloop()

if __name__ == "__main__":
    draw_cat()
